package com.zmj.sy.mom.srv.aps.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class TimeSplitUtils {

    public static String nestPreName() {
        LocalDateTime now = LocalDateTime.now();
        String string = now.toString();

        String[] split = string.split("T");

        String[] splitDay = split[0].split("-");
        String[] splitTime = split[1].split(":");
        return splitDay[0] + splitDay[1] + splitDay[2] + "-" + splitTime[0] + splitTime[1];
    }

    public static String nestDateName() {
        LocalDateTime now = LocalDateTime.now();
        LocalDate today = LocalDate.now();
        String splitDateTime = today + " 06:00:00";
        LocalDateTime splitTime = LocalDateTime.parse(splitDateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

        if (now.isBefore(splitTime)) {
            today = today.minusDays(1);
            String string = today.toString();

            String[] split = string.split("-");
            return split[0] + split[1] + split[2];
        } else {
            String string = today.toString();

            String[] split = string.split("-");
            return split[0] + split[1] + split[2];
        }
    }

    /*public static String workGroupCode(BigDecimal thickness) {
        *//**
         * 根据厚度进行划分工作组
         * 0 < t <=25 激光1
         * 30 <= t < 50 激光2
         * 50 <= t 火焰或者激光火焰复合切，默认激光火焰复合切
         *//*
        if (thickness.intValue()<=25) {
            return "1-2_JGQG_00";
        } else if (thickness.intValue()>=30&&thickness.intValue()<50) {
            return "1-3_JGQG_00";
        } else if (thickness.intValue()>=50) {
            return "1-1_FHQG_00";
        } else {
            throw SyExceptionUtils.e("厚度异常。");
        }
    }*/

}
